﻿namespace WebChat_MVC.Hubs
{
    public class UserContext
    {
        /// <summary>
        /// 用户集合
        /// </summary>
        public List<User> Users { get; set; } = new();

        /// <summary>
        /// 连接集合
        /// </summary>
        public List<Connection> Connections { get; set; } = new();

        /// <summary>
        /// 房间集合
        /// </summary>
        public List<ConversationRoom> ConversationRooms { get; set; } = new();
    }

    public class User
    {
        public string UserName { get; set; }

        public List<Connection> Connections { get; set; } = new();

        public virtual List<ConversationRoom> ConversationRooms { get; set; } = new();
    }

    public class Connection
    {
        public string ConnectionId { get; set; }

        /// <summary>
        /// 用户代理
        /// </summary>
        public string UsertAgent { get; set; }

        /// <summary>
        /// 是否连接
        /// </summary>
        public bool Connected { get; set; }
    }

    /// <summary>
    /// 房间类
    /// </summary>
    public class ConversationRoom
    {
        public string RoomName { get; set; }
        public virtual List<User> Users { get; set; }

        public ConversationRoom()
        {
            Users = new List<User>();
        }
    }
}